package the.offer.DesignPattern.creational.Singleton;


/**
 * 懒汉式单例：类初始化时不创建单例对象（延迟加载），使用时才去创建对象
 */
public class LazySingleton {
    private static LazySingleton lazySingleton = null;

    private LazySingleton() {
    }

    public synchronized static LazySingleton getInstance() {
        if (lazySingleton == null) {
            lazySingleton = new LazySingleton();
        }
        return lazySingleton;
    }
}